CROSSLINK-303 Add closing action mapping - #690
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a closingAction concept to the patron-request state model and wires scheduler “request aging” to use that state-driven closing action (instead of hard-coded borrower/lender defaults), aligning batch closures with the configured workflow.
Changes:
- Add
closingActionto the state model (YAML) and expose it via schema/OpenAPI. - Extend action-mapping to parse and expose a per-state closing action.
- Update request-aging batch action to invoke the mapped closing action and adjust tests accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| misc/state-models.yaml | Adds closingAction: cannot-supply to selected SUPPLIER states used by request-aging defaults. |
| misc/state-model.json | Extends the state-model schema with closingAction. |
| broker/scheduler/service/batch_action.go | Request aging now derives the background action from the state model’s closing action. |
| broker/scheduler/service/batch_action_test.go | Updates request-aging tests to reflect state-model-derived actions and new error behavior. |
| broker/patron_request/service/action_mapping.go | Parses closingAction into the state config and exposes GetClosingAction; records model name for error reporting. |
| broker/patron_request/service/action_mapping_test.go | Adds unit coverage for GetClosingAction. |
| broker/oapi/open-api.yaml | Adds closingAction to the API schema for states. |
Comments suppressed due to low confidence (1)
broker/scheduler/service/batch_action.go:154
- Failing the entire batch when a state has no closingAction configured means one unexpected state (or a config drift) stops processing for all other requests. Since the loop already tolerates CreateTask failures, consider treating a missing closing action similarly (record and continue) so the batch run remains best-effort.
action := actionMapping.GetClosingAction(pr)
if action == nil {
return events.NewErrorResult("could not find closing action for patron request state: "+string(pr.State)+" within state model: "+actionMapping.StateModelName, "closing action not found")
}
adamdickmeiss
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.